<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateCompanyOilCardTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('company_oil_card', function (Blueprint $table) {
            $table->increments('id');
            $table->tinyInteger('type')->comment('1:中石化2:中石油');
            $table->string('card_no')->comment('卡号');
            $table->tinyInteger('status')->default(0)->comment('0:未使用1:已使用');
            $table->dateTime('used_at')->nullable()->comment('使用时间');
            $table->unsignedInteger('user_id')->default(0)->comment('用户ID');
            $table->timestamps();
        });

        Schema::table('oil_card',function(Blueprint $table){
            $table->tinyInteger('is_company_card')->default(0)->comment('是否是公司卡0:否1:是');
        });

        Schema::create('handle_recharge_task',function(Blueprint $table){
            $table->increments('id');
            $table->unsignedInteger('user_id')->default(0)->comment('用户id');
            $table->unsignedInteger('recharge_order_id')->default(0)->comment('订单id');
            $table->unsignedInteger('recharge_order_detail_id')->default(0)->comment('订单详情id');
            $table->unsignedInteger('card_type')->comment('卡类型1:中石化2:中石油');
            $table->string('card_no')->nullable()->comment('卡号');
            $table->string('card_mobile')->nullable()->comment('持卡人手机号');
            $table->string('card_name')->nullable()->comment('持卡人姓名');
            $table->tinyInteger('status')->default(0)->comment('状态0:未充1:已充');
            $table->timestamps();
        });

    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('company_oil_card');
    }
}
